//
//  PayResultView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/4/2.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "PayResultView.h"
#import <Masonry.h>
@implementation PayResultView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    self.headerImv = [[UIImageView alloc] init];
    self.headerImv.image = [UIImage imageNamed:@"icon_jiaoyi_success"];
    [self addSubview:self.headerImv];
    [self.headerImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.centerX.equalTo(self);
        make.width.mas_equalTo(38);
        make.height.mas_equalTo(38);
    }];
    
    self.consumeSuccLab = [[UILabel alloc] init];
    self.consumeSuccLab.text = @"交易成功";
    self.consumeSuccLab.textColor = ETColorWithRGB(91, 113, 255);
    self.consumeSuccLab.font = [UIFont systemFontOfSize:14];
    [self addSubview:self.consumeSuccLab];
    [self.consumeSuccLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.headerImv);
        make.top.equalTo(self.headerImv.mas_bottom).offset(20);
    }];
    
    self.moneyNumLab = [[UILabel alloc] init];
    
    
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"￥3.00"];
    [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:24] range:NSMakeRange(0, 1)];
    [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:35] range:NSMakeRange(1, 4)];
    [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:51.0f/255.0f green:51.0f/255.0f blue:51.0f/255.0f alpha:1.0f] range:NSMakeRange(0, 4)];
    self.moneyNumLab.attributedText = attributedString;
    [self addSubview:self.moneyNumLab];
    [self.moneyNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.headerImv);
        make.top.equalTo(self.consumeSuccLab.mas_bottom).offset(20);
    }];
    
    
    self.lineView = [[UIView alloc] init];
    self.lineView.backgroundColor = ETColorWithRGB(229, 229, 229);
    [self addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.equalTo(self.moneyNumLab.mas_bottom).offset(30);
        make.height.mas_equalTo(1);
    }];
    
    
    
    
    self.midView = [[UIView alloc] init];
    self.midView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.midView];
    [self.midView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.lineView.mas_bottom);
        make.height.mas_equalTo(130);
    }];
    
    self.collecCardLab = [[UILabel alloc] init];
    self.collecCardLab.text = @"收款卡";
    self.collecCardLab.textColor = ETColorWithRGB(153, 153, 153);
    self.collecCardLab.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.collecCardLab];
    
    self.orderNumLab = [[UILabel alloc] init];
    self.orderNumLab.text = @"订单编号";
    self.orderNumLab.textColor = ETColorWithRGB(153, 153, 153);
    self.orderNumLab.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.orderNumLab];
    
    self.tradeTimeLab = [[UILabel alloc] init];
    self.tradeTimeLab.text = @"交易时间";
    self.tradeTimeLab.textColor = ETColorWithRGB(153, 153, 153);
    self.tradeTimeLab.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.tradeTimeLab];
    
    //竖向排列
    
    NSMutableArray *VerticalArray = [NSMutableArray array];
    [VerticalArray addObject:self.collecCardLab];
    [VerticalArray addObject:self.orderNumLab];
    [VerticalArray addObject:self.tradeTimeLab];
    
    [VerticalArray mas_distributeViewsAlongAxis:(MASAxisTypeVertical) withFixedSpacing:20 leadSpacing:20 tailSpacing:20];
    [VerticalArray mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
    }];
    
    
    self.collecCardValueLab = [[UILabel alloc] init];
    self.collecCardValueLab.text = @"中国工商银行(尾号0899)";
    self.collecCardValueLab.textColor = ETColorWithRGB(51, 51, 51);
    self.collecCardValueLab.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.collecCardValueLab];
    [self.collecCardValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(self.collecCardLab);
    }];
    
    self.orderNumValueLab = [[UILabel alloc] init];
    self.orderNumValueLab.text = @"34093284902389";
    self.orderNumValueLab.textColor = ETColorWithRGB(51, 51, 51);
    self.orderNumValueLab.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.orderNumValueLab];
    [self.orderNumValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(self.orderNumLab);
    }];
    
    self.tradeTimeValueLab = [[UILabel alloc] init];
    self.tradeTimeValueLab.text = @"2018-09-11 11:11:22";
    self.tradeTimeValueLab.textColor = ETColorWithRGB(51, 51, 51);
    self.tradeTimeValueLab.font = [UIFont systemFontOfSize:14];
    [self.midView addSubview:self.tradeTimeValueLab];
    [self.tradeTimeValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(self.tradeTimeLab);
    }];
    
    self.finishedBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.finishedBtn setTitle:@"完成" forState:(UIControlStateNormal)];
    [self.finishedBtn setTitleColor:ETColorWithRGB(91, 113, 255) forState:(UIControlStateNormal)];
    self.finishedBtn.layer.cornerRadius = 22;
    self.finishedBtn.layer.borderWidth = 1;
    self.finishedBtn.layer.borderColor = [UIColor colorWithRed:91 / 255.0 green:113 / 255.0 blue:255 / 255.0 alpha:1].CGColor;
    self.finishedBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.finishedBtn];
    [self.finishedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.midView.mas_bottom).offset(130);
        make.left.mas_equalTo(67);
        make.right.mas_equalTo(-67);
        make.height.mas_equalTo(44);
    }];
}

@end
